﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web.Security;
using System.IO;
using System.Data.SqlClient;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class SAClientWeb_MainDatalist : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Guid id = new Guid(Request.QueryString["FamilyID"]);
        showpic(id);
    }
    private void showpic(Guid id)
    {
        string constr = "Data Source=406-PC\\SQLEXPRESS;Initial Catalog=XunPan;User ID=XunPan_sa;Password=123456";

        string sql = "select * from [XunPanDB].[dbo].[FamilyAttrs] where FamilyID='" + id + "'";
        SqlConnection conn = new SqlConnection(constr);
        conn.Open();

        SqlCommand comm = new SqlCommand(sql, conn);
        SqlDataReader reader = comm.ExecuteReader();
        while (reader.Read())
        {
            Response.ContentType = "application/octet-stream";
            Response.BinaryWrite((byte[])reader["ModelPicBinary"]);
            Response.Write("successful");
        }
        reader.Close();
        conn.Close();
        Response.End();
    }
}